package Visitor;

import Arbori.Nod;
import Functii.*;
import Functii.Elementare.*;
import Functii.Trigonometrice.*;
import Operator.*;

public class ToStringVisitor extends Visitor{
	String s;
	public ToStringVisitor(){
		this.s = "";
	}
	public ToStringVisitor(String s){
		this.s = s;
	}
	
	public String getS() {
		return s;
	}
	public void setS(String s) {
		this.s = s;
	}
	public void visit(Plus p) {
		visit(p);
	}

	public void visit(Minus m) {
		visit(m);
	}

	public void visit(Produs p) {
		visit(p);
	}

	public void visit(Cat c) {
		visit(c);
	}
	
	public void visit(Operator o){
		if(o.getfStang() != null && o.getfDrept() != null){
			visit(o.getfStang());
			String s1 = this.s;
			visit(o.getfDrept());
			String s2 = this.s;
			s = o.concatTermeni(s1, s2);
		}
	}

	public void visit(Functie f) {
		if(f.getfStang() != null){
			visit(f.getfStang());
			String s1 = this.s;
			s = f.concatTermeni(s1);
		}
	}
	public void visit(Sin s) {
		visit(s);
	}

	public void visit(Cos c) {
		visit(c);
	}

	public void visit(Tg t) {
		visit(t);
	}

	public void visit(Ctg c) {
		visit(c);
	}

	public void visit(Arcsin as) {
		visit(as);
	}

	public void visit(Arccos ac) {
		visit(ac);
	}

	public void visit(Arctg at) {
		visit(at);
	}

	public void visit(Arcctg ac) {
		visit(ac);
	}

	public void visit(Sinh sh) {
		visit(sh);
	}

	public void visit(Cosh ch) {
		visit(ch);
	}

	public void visit(Constanta c) {
		this.s = Double.toString(c.getCt());
	}

	public void visit(Necunoscuta n) {
		this.s = "x";
	}

	public void visit(Radical r) {
		visit(r);
	}

	public void visit(Putere p) {
		visit(p);
	}

	public void visit(Exp e) {
		visit(e);
	}

	public void visit(Log l) {
		visit(l);
	}

	public void visit(Nod n) {
		// TODO Auto-generated method stub
		
	}

}
